<?php
	require_once("conexion/conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario Busqueda</title>
<link href="Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="include_js/jquery.js" type="text/javascript"></script>

<script>
var arr = new Array();
var cont=0;

function borracampo()
{  
	if( document.form_Busqueda.txtFormulario.value == "Numero Formulario")  
    document.form_Busqueda.txtFormulario.value = ""; 
}  

function restauracampo()
{  
  if((document.form_Busqueda.txtFormulario.value=="")||(document.form_Busqueda.txtFormulario.value!=""))
  document.form_Busqueda.txtFormulario.value="Numero Formulario"; 
} 

function LimpiarCombo(combo)
{
	while(combo.length > 1)
	{
		combo.remove(combo.length-1);
	}
}
function LlenarCombo(json,combo){
	combo.options[0] = new Option('--Analisis--', '0');
	for(var i=0;i<json.length;i++)
	{
		combo.options[combo.length] = new Option(json[i].data, json[i].id);
	}
}
function SeleccionandoCombo(combo1, combo2)
{
	alert(combo1.options[combo1.selectedIndex].value);
	combo2 = document.getElementById(combo2);
	//LimpiarCombo(combo2);
	if(combo1.options[combo1.selectedIndex].value != "0")
	{
		//combo1.disabled = true;
		//combo2.disabled = true;
		LimpiarCombo(combo2);
		$.ajax({
			type: 'post',
			dataType: 'json',
			url: 'Produccion/lista_sustancia.php',
			data: {valor: combo1.options[combo1.selectedIndex].value},
			success: function(json){
				LlenarCombo(json,combo2);
				//combo1.disabled = false;
				combo2.disabled = false;
			}
		});
	}
	else
	{
		LimpiarCombo(combo2);
		combo2.disabled = true;
	}
}

function Cargar(valor,url,contenedor)
{
    x=document.getElementById(contenedor);
        $.ajax
		({
            type: 'POST',
            url: url,
            data: {valor: valor},
            success: function(data)
			{
                $(x).html(data);
            }
        })
}
</script>

</head>

<body>
<form name="form_Busqueda_Decl" id="form_Busqueda_Decl" method="post">
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td>
	<div class='option2'><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Secci&oacute;n de busqueda.</label></div>
	<div class='groupbox'>
	<table width="100%" border="0" class="tres" cellpadding="0" cellspacing="0">
  <tr style="border:1px solid #6593C0;">
    <td width="90" style="border:1px solid #6593C0;">
        <input type="radio" class="radio" name="op" id="op" value="0" onclick="Cargar(this.value,'Produccion/carga_busqueda_decl.php','listadoBusqueda');" />
		<label style="color:#FFFFFF; font-weight:bold;">DIA</label></td>
    <td width="94" style="border:1px solid #6593C0;"><input type="radio" class="radio" name="op" id="op" value="1" onclick="Cargar(this.value,'Produccion/carga_busqueda_decl.php','listadoBusqueda');" />
	<label style="color:#FFFFFF; font-weight:bold;">INFA</label></td>
    <td width="110" style="border:1px solid #6593C0;">&nbsp;</td>
    <td width="514" style="border:1px solid #6593C0;"><label style="color:#FFFFFF; font-weight:bold;"></label></td>
    <td width="163" style="border:1px solid #6593C0;">&nbsp;</td>
  </tr>
</table>		
      </div></td>
  </tr>
</table>
</form>
<table width="100%" border="0" cellpadding="2" cellspacing="0">
  <tr>
    <td><div id="listadoBusqueda"></div></td>
  </tr>
</table>
</body>
</html>